package org.seedltd.upms.constant;

import org.seedltd.oss.Bucket;

/**
 *
 * 上传文件夹配置
 *
 * @author laizuan
 * @version 1.0
 * @since 2021/7/26 17:17
 */
public enum FolderBucket implements Bucket {
    QRCODE("qrcode", ""),
    PRODUCT("product", ""),
    REPORT("report", ""),
    TERMINAL("terminal", ""),
    OTHERS("others", "");

    private final String bucketName;
    private final String folder;

    FolderBucket(String bucketName, String folder) {
        this.bucketName = bucketName;
        this.folder = folder;
    }

    public static FolderBucket getByBuckName(String bucketName) {
        FolderBucket[] values = FolderBucket.values();
        for (FolderBucket value : values) {
            if (value.getBucketName().equals(bucketName)) {
                return value;
            }
        }
        return null;
    }

    @Override
    public String getBucketName() {
        return this.bucketName;
    }

    public String getFolder() {
        return this.folder;
    }

    public String getPath(String fileName) {
        return this.folder + "/" + fileName;
    }
}
